home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / AmigaSystem / Scalos / GuiGFXLib / src / guigfx_internal.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  5.4 KB  |  225 lines

  1. #ifndef GUIGFX_INTERNAL_H
  2. #define GUIGFX_INTERNAL_H    1
  3.  
  4.  
  5. #include "exec/exec.h"
  6. #include "graphics/view.h"
  7. #include "utility/tagitem.h"
  8.  
  9.  
  10. /****************************************************************************
  11.  
  12.     debugging
  13.  
  14. ****************************************************************************/
  15.  
  16. #ifdef DEBUG
  17. #define DB(x)    x
  18. #else
  19. #define DB(x)    ;
  20. #endif
  21.  
  22. #ifdef __MORPHOS__
  23. void dprintf(char *, ... );
  24. #undef kprintf
  25. #define kprintf dprintf
  26. #else
  27. VOID kprintf(STRPTR,...);
  28. #endif
  29.  
  30. /****************************************************************************
  31.  
  32.     Structure definitions
  33.  
  34. ****************************************************************************/
  35.  
  36. typedef APTR PALETTE;
  37.  
  38. struct SharedHistogram
  39. {
  40.     struct SignalSemaphore semaphore;
  41.     ULONG count;
  42.     APTR histogram;
  43. };
  44.  
  45. typedef struct Picture
  46. {
  47.     struct    SignalSemaphore semaphore;
  48.     UBYTE    *array;                    /* Daten */
  49.     UWORD    width, height;            /* Breite/Höhe in Pixeln */
  50.     UWORD    aspectx, aspecty;        /* x:y Pixelaspekt */
  51.     PALETTE    palette;                /* Palette im render.library Format */
  52.     ULONG    pixelformat;            /* Pixelformat */
  53.  
  54.  
  55.     BOOL    alphapresent;            /* alpha-channel vorhanden */
  56.     UBYTE    *alphaarray;            /* separater (ausgelagerter) alpha-channel */
  57.  
  58.     struct    SharedHistogram *histogram;
  59.  
  60.     UWORD    hstype;                    /* palette und histogramm */
  61.  
  62.     BOOL    owner;                    /* zeigt an, daß das Array auch gelöscht werden muß */
  63.     ULONG    maxbytes;                /* nur bei owner==FALSE - Größe des Speicherbereichs */
  64.  
  65.     struct    DrawHandle *directdraw;    /* auf dieses Drawhandle kann direkt gezeichnet werden */
  66.  
  67.  
  68.     APTR    scaleengine;
  69.     WORD    scalesourcewidth, scalesourceheight;
  70.     WORD    scaledestwidth, scaledestheight;
  71.     ULONG    scalepixelformat;
  72.     BOOL    scalecoords;
  73.  
  74. } PIC;
  75.  
  76.  
  77. typedef struct ColorHandle
  78. {
  79.     struct    Node node;                        /* Verkettung in der colorlist der PenShareMap */
  80.     ULONG    numpixels;                        /* Anzahl repräsentierter Pixel */
  81.     UWORD    weight;                            /* Gewichtung */
  82.     struct    PenShareMap *psm;                /* zugehörige Pensharemap */
  83.     struct    SharedHistogram *histogram;        /* SharedHistogram */
  84.  
  85. } COLORHANDLE;
  86.  
  87.  
  88. typedef struct RastHandle
  89. {
  90.     struct    RastPort *rp;
  91.     UWORD    drawmode;
  92.     BOOL    truecolor;
  93.     struct    RastPort *temprp;
  94.     UWORD    colormode;
  95.  
  96. } RASTHANDLE;
  97.  
  98.  
  99. typedef struct DrawHandle
  100. {
  101.     struct    RastHandle *rasthandle;    /* RastHandle mit Informationen zum Rastport */
  102.  
  103.     struct    PenShareMap *psm;        /* die zugehörige PenShareMap */
  104.  
  105.     struct    ColorMap *colormap;        /* Colormap, von der angefordert wurde */
  106.     ULONG    precision;                /* precision, mit der angefordert wurde */
  107.  
  108.     PALETTE    mainpalette;
  109.     UWORD    mainnumcolors;
  110.     UBYTE    mainpentab[256];
  111.  
  112. //    APTR    basepalette;
  113. //    UWORD    basenumcolors;
  114. //    UBYTE    basepentab[256];
  115.  
  116.     struct    SignalSemaphore mapsemaphore;    //    semaphore für die mapengine
  117.     APTR    mapengine;                        // mapengine für eine realpalette
  118.  
  119.     PALETTE    realpalette;            /* die tatsächlichen Farben auf dem Screen */
  120.  
  121.     UWORD    dithermode;
  122.     UWORD    ditheramount;
  123.     BOOL    autodither;
  124.     UWORD    ditherthreshold;
  125.  
  126.     ULONG    modeID;                    /* optional: screen's modeID */
  127.  
  128.     ULONG    bgcolor;
  129.     LONG    bgpen;
  130.  
  131. } DRAWHANDLE;
  132.  
  133.  
  134. typedef struct PenShareMap
  135. {
  136.     UWORD    hstype;                /* globale Einstellungen */
  137.  
  138.     struct    SignalSemaphore semaphore;    /* Schutz für die folgenden Daten */
  139.  
  140.     APTR    histogram;            /* globales Histogramm der PenShareMap */
  141.     struct    List colorlist;            /* Liste der Colorhandles */
  142.     UWORD    numcolorhandles;        /* Anzahl Colorhandles in der Liste */
  143.     BOOL    modified;            /* die Liste wurde verändert */
  144.  
  145. } PSM;
  146.  
  147.  
  148.  
  149. typedef struct DirectDrawHandle
  150. {
  151.     DRAWHANDLE    *dh;                // das entsprechende Drawhandle
  152.     int sourcewidth, sourceheight;
  153.     int destwidth, destheight;
  154.  
  155.     APTR scaleengine;                // scaling-engine
  156.  
  157.     APTR scalebuffer;                // Buffer für skalierte Daten
  158.     APTR mapbuffer;                    // if present, it's more effective to map before scale
  159.  
  160.     int    drawmode;            
  161.  
  162.     int pixelformat;                // source
  163.     
  164. } DIRECTDRAWHANDLE;
  165.  
  166. #define    DDMODE_DRAW                0
  167. #define    DDMODE_SCALEDRAW        1
  168. #define    DDMODE_MAPDRAW            2
  169. #define    DDMODE_MAPSCALEDRAW        3
  170. #define    DDMODE_SCALEMAPDRAW        4
  171.  
  172.  
  173.  
  174. /****************************************************************************
  175.  
  176.     miscellaneous
  177.  
  178. ****************************************************************************/
  179.  
  180. typedef struct TagItem * TAGLIST;
  181.  
  182. #define    PIXELSIZE(a) ((a) == PIXFMT_CHUNKY_CLUT ? sizeof(UBYTE) : ((a) == PIXFMT_0RGB_32 ? sizeof(ULONG) : 3))
  183.  
  184. #define RED_RGB32(a) ((((a) & 0xff0000)<<8) + ((a) & 0xff0000) + (((a) & 0xff0000)>>8) + (((a) & 0xff0000)>>16))
  185. #define GREEN_RGB32(a) ((((a) & 0x00ff00)<<16) + (((a) & 0x00ff00)<<8) + ((a) & 0x00ff00) + (((a) & 0x00ff00)>>8))
  186. #define BLUE_RGB32(a) ((((a) & 0x0000ff)<<24) + (((a) & 0x0000ff)<<16) + (((a) & 0x0000ff)<<8) + ((a) & 0x0000ff))
  187.  
  188.  
  189. /****************************************************************************
  190.  
  191.     constants
  192.  
  193. ****************************************************************************/
  194.  
  195. #define DRAWMODE_WRITEPIXELARRAY        0
  196. #define DRAWMODE_WRITECHUNKYPIXELS        1
  197. #define DRAWMODE_CYBERGFX                2
  198. #define DRAWMODE_BITMAP                    3
  199.  
  200. #define THRESHOLD_SPAREMODE                20
  201.  
  202. #define    DEFAULT_AUTODITHER_THRESHOLD    250
  203. #define    DEFAULT_AUTODITHER                TRUE
  204. #define    DEFAULT_DITHERMODE                DITHERMODE_EDD
  205. #define    DEFAULT_DITHERAMOUNT            40
  206.  
  207. #define    DEFAULT_RMHTYPE                    RMHTYPE_POOL    /* !!!!! */
  208.  
  209. #define    DEFAULT_HSTYPE                    HSTYPE_12BIT_TURBO
  210. #define    DEFAULT_PICTURE_HSTYPE            DEFAULT_HSTYPE
  211. #define    DEFAULT_PALETTE_HSTYPE            DEFAULT_HSTYPE
  212. #define    DEFAULT_PICTURE_INTERLEAVE        7
  213.  
  214. #define    DEFAULT_RGBWEIGHT                0x010101
  215.  
  216. #define    HSTYPE_UNDEFINED                0
  217.  
  218. #define CYBERGFX_VERSION                40
  219. #define    RENDER_VERSION                    30
  220. #define DATATYPES_VERSION                39
  221.  
  222. #define    DEFAULT_BGCOLOR                    0x000000
  223.  
  224. #endif
  225.